Function.RegisterNamespace("System.Web.StorageStrategy");

System.Web.StorageStrategy.Legacy=function(){
    // IStorageStrategy Methods
    this.Clear=function(name){
        var expiration=new Date();
        expiration.setDate(expiration.getDate()-1);
        setValue(name,'',expiration);
    };

    this.Get=function(name){
        var pairs=document.cookie.split(';');
        for(var i=0;i<pairs.length;i++){
            var cookie=pairs[i].split('=');
            if(unescape(cookie[0])==name)return unescape(cookie[1]);
        }
        return null;
    };

    this.Set=function(name,value){
        var expiration=new Date();
        expiration.setFullYear(expiration.getFullYear()+10);
        setValue(name,value,expiration);
    };

    // IStrategySpecification Members
    this.IsSatisfiedBy=function(candidate){
        return typeof(document)!="undefined";
    };

    // Private Methods
    function setValue(name,value,expiration){
        document.cookie=String.Format("{0}={1};expires={2}",escape(name),escape(value),expiration.toUTCString());
    }
};

System.Web.StorageStrategy.Legacy.Implement(System.Web.Storage.IStorageStrategy,"System.Web.StorageStrategy.Legacy");
System.Web.StorageStrategy.Legacy.Implement(System.Script.Strategy.IStrategySpecification,'System.Web.StorageStrategy.Legacy');